using SQLServices.RunnableItems;

namespace SQLRunnerLib.RunnableItems
{
    public abstract class ProjectItem : IProjectItem
    {

        #region Private Instances

        private RunnableState _state;
        private readonly string _name;
        private readonly IItemPath _path;
        private string _error;
        private readonly SQLServices.RunnableItems.IProjectItem _parent;
        private bool _ignore;
        private bool _selected;

        #endregion

        #region Constructor
        protected ProjectItem(string name, SQLServices.RunnableItems.IProjectItem parent, bool ignore, IItemPath path)
        {
            _state = RunnableState.PENDING;
            _name = name;
            _parent = parent;
            _ignore = ignore;
            _path = path;
            _selected = false;
        }

        #endregion

        #region IProjectItem Members

        public RunnableState State
        {
            get { return _state; }
            set { _state = value; }
        }

        public string Name
        {
            get { return _name; }
        }

        public string Error
        {
            get { return _error; }
            set { _error = value; }
        }

        public bool Selected
        {
            get { return _selected;  }
            set { _selected = value; }
        }

        public IItemPath Path
        {
            get { return _path; }
        }

        public SQLServices.RunnableItems.IProjectItem Parent
        {
            get { return _parent; }
        }

        public bool Ignore
        {
            get { return _ignore; }
            set { _ignore = value; }
        }

        #endregion

    }
}